home *** CD-ROM | disk | FTP | other *** search
/ IRIX Installation Tools & Overlays 2002 November / SGI IRIX Installation Tools & Overlays 2002 November - Disc 4.iso / dist / motif21_dev.idb / usr / Motif-2.1 / include / Xm / LabelGP.h.z / LabelGP.h
C/C++ Source or Header  |  2002-10-15  |  12KB  |  334 lines

  1. /* 
  2.  *  @OSF_COPYRIGHT@
  3.  *  COPYRIGHT NOTICE
  4.  *  Copyright (c) 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
  5.  *  ALL RIGHTS RESERVED (MOTIF). See the file named COPYRIGHT.MOTIF for
  6.  *  the full copyright text.
  7. */ 
  8. /* 
  9.  * HISTORY
  10. */ 
  11. /* $XConsortium: LabelGP.h /main/12 1995/10/25 20:08:21 cde-sun $ */
  12. /* (c) Copyright 1989, DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. */
  13. /* (c) Copyright 1987, 1988, 1989, 1990, 1991, 1992 HEWLETT-PACKARD COMPANY */
  14. #ifndef _XmLabelGP_h
  15. #define _XmLabelGP_h
  16.  
  17. #include <Xm/LabelG.h>
  18. #include <Xm/GadgetP.h>
  19. #include <Xm/ExtObjectP.h>
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25. /*************************************************************/
  26. /* The Label Gadget Cache Object's class and instance records*/
  27. /*************************************************************/
  28.  
  29. /* Enumerations for fill_bg_box. */
  30. enum { _XmPLAIN_BG_BOX, _XmFILL_BG_BOX, _XmALWAYS_FILL_BG_BOX };
  31.  
  32. typedef struct _XmLabelGCacheObjClassPart
  33. {
  34.   int foo;
  35. #ifdef _SGIMOTIF
  36.   XtPointer    _SG_vendorExtension;
  37. #endif
  38. } XmLabelGCacheObjClassPart;
  39.  
  40.  
  41. typedef struct _XmLabelGCacheObjClassRec     /* label cache class record */
  42. {
  43.   ObjectClassPart        object_class;
  44.   XmExtClassPart                ext_class;
  45.   XmLabelGCacheObjClassPart    label_class_cache;
  46. } XmLabelGCacheObjClassRec;
  47.  
  48. externalref XmLabelGCacheObjClassRec xmLabelGCacheObjClassRec;
  49.  
  50.  
  51. /*  The Label Gadget Cache instance record  */
  52.  
  53. typedef struct _XmLabelGCacheObjPart
  54. {
  55.   unsigned char    label_type;
  56.   unsigned char    alignment;
  57.   unsigned char    string_direction;
  58.   
  59.   Dimension    margin_height;   /* margin around widget */
  60.   Dimension    margin_width;
  61.   
  62.   Dimension    margin_left;    /* additional margins on */
  63.   Dimension    margin_right;   /* each side of widget */
  64.   Dimension    margin_top;     /* text (or pixmap) is placed */
  65.   Dimension    margin_bottom;  /* inside the margins */
  66.   
  67.   Boolean    recompute_size;
  68.   
  69.   Boolean    skipCallback;    /* set by RowColumn with entryCallback */
  70.   unsigned char menu_type;
  71.  
  72. #ifdef _SGIMOTIF
  73.   XtPointer    _SG_vendorExtension;
  74. #endif
  75.  
  76.   /*
  77.    * Following are color resources and instance variables for Gadgets.
  78.    * Because of problems involving the history of the gadget cache these
  79.    * variables appear here rather than in XmGadget.
  80.    *
  81.    * XmArrowButtonGadget and XmSeparatorGadget have effectively the same
  82.    * set of color resources implemented for each.
  83.    * 
  84.    * XmLabelGadget does not use all of these variables (e.g top_shadow_color).
  85.    * It initializes them and maintains them but does not use all of them
  86.    * to render the label gadget.  They are here for use by subclasses.
  87.    *
  88.    *  Sterling Barrett
  89.    *  sterling@ics.com
  90.    */
  91.   
  92.   GC        background_GC;
  93.   GC        top_shadow_GC;
  94.   GC        bottom_shadow_GC;
  95.   GC        highlight_GC;
  96.   
  97.   Pixel        foreground;
  98.   Pixel        background;
  99.   
  100.   Pixel        top_shadow_color;
  101.   Pixmap    top_shadow_pixmap;
  102.   
  103.   Pixel        bottom_shadow_color;
  104.   Pixmap    bottom_shadow_pixmap;
  105.   
  106.   Pixel        highlight_color;
  107.   Pixmap    highlight_pixmap;
  108.   
  109. } XmLabelGCacheObjPart;
  110.  
  111. typedef struct _XmLabelGCacheObjRec
  112. {
  113.   ObjectPart            object;
  114.   XmExtPart        ext;
  115.   XmLabelGCacheObjPart  label_cache;
  116. } XmLabelGCacheObjRec;
  117.  
  118. /*  The Label Widget Class and instance records  */
  119. /*************************************************/
  120.  
  121. typedef struct _XmLabelGadgetClassPart     /* label class record */
  122. {
  123.   XtWidgetProc        setOverrideCallback;
  124.   XmMenuProc        menuProcs;
  125.   XtPointer        extension;
  126. #ifdef _SGIMOTIF
  127.   XtPointer    _SG_vendorExtension;
  128. #endif
  129.  
  130. } XmLabelGadgetClassPart;
  131.  
  132. typedef struct _XmLabelGadgetClassRec
  133. {
  134.   RectObjClassPart       rect_class;
  135.   XmGadgetClassPart      gadget_class;
  136.   XmLabelGadgetClassPart label_class;
  137. } XmLabelGadgetClassRec;
  138.  
  139. externalref XmLabelGadgetClassRec xmLabelGadgetClassRec;
  140.  
  141. typedef struct _XmLabelGadgetPart
  142. {
  143.   _XmString      _label;  /* String sent to this widget */
  144.   _XmString       _acc_text;
  145.   KeySym          mnemonic;
  146.   XmStringCharSet mnemonicCharset;
  147.   char           *accelerator;
  148.   XmFontList      font;
  149.   
  150.   Pixmap      pixmap; 
  151.   Pixmap      pixmap_insen; 
  152.   
  153.   /* PRIVATE members -- values computed by LabelWidgetClass methods */
  154.   
  155.   GC          normal_GC;   /* GC for text */    
  156.   GC          insensitive_GC;
  157.   XRectangle      TextRect;     /* The bounding box of the text or clip */
  158.   XRectangle      acc_TextRect; /* rectangle of the window; whichever is
  159.                  smaller */
  160.   
  161.   XmLabelGCacheObjPart *cache;
  162.   
  163. #ifdef _SGIMOTIF
  164.   XtPointer    _SG_vendorExtension;
  165. #endif
  166.   
  167.   Dimension      acc_left_delta;  /* Amount we increased the margins */
  168.   Dimension      acc_right_delta; /* to accomodate accelerator text */
  169.  
  170.   Dimension    * baselines;    /* Cached baseline information. */
  171.  
  172.   XtEnum          fill_bg_box;     /* Computed by LabelGadget or */
  173.                    /* pinned by subclasses. */
  174.   Boolean      check_set_render_table;
  175.  
  176. } XmLabelGadgetPart;
  177.  
  178.  
  179. typedef struct _XmLabelGadgetRec
  180. {
  181.   ObjectPart        object;
  182.   RectObjPart       rectangle;
  183.   XmGadgetPart      gadget;
  184.   XmLabelGadgetPart label;
  185. } XmLabelGadgetRec;
  186.  
  187. typedef struct _LRectangle
  188. {
  189.   int x, y;
  190.   int width, height;
  191. } LRectangle;
  192.  
  193. /* Inherited  Functions exported by label */
  194.  
  195. #define XmInheritSetOverrideCallback    ((XtWidgetProc) _XtInherit)
  196. #define XmInheritResize            ((XtWidgetProc) _XtInherit)
  197.  
  198. #define INVALID_PIXEL    ((Pixel) -1)
  199. #define INVALID_PIXMAP    ((Pixmap) -1)
  200. /* Padding between label text and accelerator text */
  201.  
  202. #define LABELG_ACC_PAD    15
  203.  
  204. /* MACROS */
  205. /********
  206.  * Macros for cached instance fields
  207.  */
  208. #define LabG_LabelType(w)        (((XmLabelGadget)(w)) -> \
  209.                        label.cache-> label_type)
  210. #define LabG_Alignment(w)        (((XmLabelGadget)(w)) -> \
  211.                        label.cache-> alignment)
  212. #define LabG_StringDirection(w)        (((XmLabelGadget)(w)) -> \
  213.                        label.cache-> string_direction)
  214. #define LabG_MarginHeight(w)        (((XmLabelGadget)(w)) -> \
  215.                                            label.cache-> margin_height)
  216. #define LabG_MarginWidth(w)        (((XmLabelGadget)(w)) -> \
  217.                                            label.cache-> margin_width)
  218. #define LabG_MarginLeft(w)        (((XmLabelGadget)(w)) -> \
  219.                                            label.cache-> margin_left)
  220. #define LabG_MarginRight(w)        (((XmLabelGadget)(w)) -> \
  221.                                            label.cache-> margin_right)
  222. #define LabG_MarginTop(w)        (((XmLabelGadget)(w)) -> \
  223.                                            label.cache-> margin_top)
  224. #define LabG_MarginBottom(w)        (((XmLabelGadget)(w)) -> \
  225.                                            label.cache-> margin_bottom)
  226. #define LabG_RecomputeSize(w)        (((XmLabelGadget)(w)) -> \
  227.                                            label.cache-> recompute_size)
  228. #define LabG_SkipCallback(w)        (((XmLabelGadget)(w)) -> \
  229.                                            label.cache-> skipCallback)
  230. #define LabG_MenuType(w)        (((XmLabelGadget)(w)) -> \
  231.                                            label.cache-> menu_type)
  232. #define LabG_BackgroundGC(w)        (((XmLabelGadget)(w)) -> \
  233.                                            label.cache-> background_GC)
  234. #define LabG_TopShadowGC(w)        (((XmLabelGadget)(w)) -> \
  235.                                            label.cache-> top_shadow_GC)
  236. #define LabG_BottomShadowGC(w)        (((XmLabelGadget)(w)) -> \
  237.                                            label.cache-> bottom_shadow_GC)
  238. #define LabG_HighlightGC(w)        (((XmLabelGadget)(w)) -> \
  239.                                            label.cache-> highlight_GC)
  240. #define LabG_Foreground(w)        (((XmLabelGadget)(w)) -> \
  241.                                            label.cache-> foreground)
  242. #define LabG_Background(w)        (((XmLabelGadget)(w)) -> \
  243.                                            label.cache-> background)
  244. #define LabG_TopShadowColor(w)        (((XmLabelGadget)(w)) -> \
  245.                                            label.cache-> top_shadow_color)
  246. #define LabG_TopShadowPixmap(w)        (((XmLabelGadget)(w)) -> \
  247.                                            label.cache-> top_shadow_pixmap)
  248. #define LabG_BottomShadowColor(w)    (((XmLabelGadget)(w)) -> \
  249.                                            label.cache-> bottom_shadow_color)
  250. #define LabG_BottomShadowPixmap(w)    (((XmLabelGadget)(w)) -> \
  251.                                            label.cache-> bottom_shadow_pixmap)
  252. #define LabG_HighlightColor(w)            (((XmLabelGadget)(w)) -> \
  253.                                            label.cache-> highlight_color)
  254. #define LabG_HighlightPixmap(w)            (((XmLabelGadget)(w)) -> \
  255.                                            label.cache-> highlight_pixmap)
  256. /********
  257.  * Macros for UNcached instance fields
  258.  */
  259. #define LabG__label(w)            (((XmLabelGadget)(w)) -> \
  260.                        label._label)
  261. #define LabG__acceleratorText(w)    (((XmLabelGadget)(w)) -> \
  262.                                            label._acc_text)
  263. #define LabG_Font(w)            (((XmLabelGadget)(w)) -> \
  264.                        label.font)
  265. #define LabG_Mnemonic(w)        (((XmLabelGadget)(w)) -> \
  266.                        label.mnemonic)
  267. #define LabG_MnemonicCharset(w)         (((XmLabelGadget)(w)) -> \
  268.                                            label.mnemonicCharset)
  269. #define LabG_Accelerator(w)        (((XmLabelGadget)(w)) -> \
  270.                                            label.accelerator)
  271. #define LabG_Pixmap(w)            (((XmLabelGadget)(w)) -> \
  272.                                            label.pixmap)
  273. #define LabG_PixmapInsensitive(w)    (((XmLabelGadget)(w)) -> \
  274.                                            label.pixmap_insen)
  275. #define LabG_NormalGC(w)        (((XmLabelGadget)(w)) -> \
  276.                                            label.normal_GC)
  277. #define LabG_InsensitiveGC(w)        (((XmLabelGadget)(w)) -> \
  278.                                            label.insensitive_GC)
  279. #define LabG_TextRect(w)        (((XmLabelGadget)(w)) -> \
  280.                                            label.TextRect)
  281. #define LabG_AccTextRect(w)        (((XmLabelGadget)(w)) -> \
  282.                                            label.acc_TextRect)
  283.  
  284.  
  285. /********
  286.  * Convenience Macros 
  287.  */
  288. #define LabG_TextRect_x(w)        (LabG_TextRect(w).x)
  289.                                            
  290. #define LabG_TextRect_y(w)        (LabG_TextRect(w).y)
  291.                                            
  292. #define LabG_TextRect_width(w)        (LabG_TextRect(w).width)
  293.                                            
  294. #define LabG_TextRect_height(w)        (LabG_TextRect(w).height)
  295.                                            
  296. #define LabG_IsText(w)            (LabG_LabelType(w) == XmSTRING)
  297.  
  298. #define LabG_IsPixmap(w)        (LabG_LabelType(w) == XmPIXMAP)
  299.  
  300. #define LabG_Cache(w)            (((XmLabelGadget)(w))-> \
  301.                        label.cache)
  302. #define LabG_Shadow(w)    (((XmLabelGadget)(w))->gadget.shadow_thickness)
  303. #define LabG_Highlight(w) (((XmLabelGadget)(w))->gadget.highlight_thickness)
  304. #define LabG_Baseline(w)  (_XmStringBaseline ((LabG_Font(w)), (LabG__Label(w))))
  305. #define LabG_ClassCachePart(w)    \
  306.     (((XmLabelGadgetClass)xmLabelGadgetClass)->gadget_class.cache_part)
  307.  
  308. #define LabG_IsMenupane(w)    ((LabG_MenuType(w) == XmMENU_POPUP) ||    \
  309.                  (LabG_MenuType(w) == XmMENU_PULLDOWN))
  310.  
  311. #define _XmAssignLabG_MarginHeight_r(cache, val) \
  312.         cache->margin_height = val
  313. #define _XmAssignLabG_MarginWidth_r(cache, val) \
  314.         cache->margin_width = val
  315. #define _XmAssignLabG_MarginLeft_r(cache, val) \
  316.         cache->margin_left = val
  317. #define _XmAssignLabG_MarginRight_r(cache, val) \
  318.         cache->margin_right = val
  319. #define _XmAssignLabG_MarginTop_r(cache, val) \
  320.         cache->margin_top = val
  321. #define _XmAssignLabG_MarginBottom_r(cache, val) \
  322.         cache->margin_bottom = val
  323.  
  324. extern void _XmQualifyLabelLocalCache(XmLabelGCacheObjPart *, XmLabelGadget);
  325. extern void _XmReCacheLabG_r(XmLabelGCacheObjPart *, XmLabelGadget);
  326.  
  327.  
  328. #ifdef __cplusplus
  329. }  /* Close scope of 'extern "C"' declaration which encloses file. */
  330. #endif
  331.  
  332. #endif /* _XmLabelGP_h */
  333. /* DON'T ADD ANYTHING AFTER THIS #endif */
  334.